perm filename IMPLSN[SS,SYS] blob sn#345683 filedate 1983-05-20 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00005 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	TITLE ITEST
C00003 00003	 Cono Bits . . .
C00005 00004	pln←←20
C00008 00005	space:	movei 1," "
C00010 ENDMK
C⊗;
TITLE ITEST

IMP←←400
; Cono Bits . . .

test←←100000		; Enter test mode (does anal-cranial inversion)
strin←←040000		; Start input, sets stop, clears input end
i32←←020000		; Set input byte size to 32b if IDPIEN set
o32←←010000		; Set output byte size to 32b if ODPIEN set
clrst←←004000		; Clear stop after input bit
clrwt←←002000		; Clear waiting to input bit
strout←←000200		; Start output
fino←←000100		; Finish output (last bit has been sent)
iepien←←000040		; Enable change of input end interrupt channel
idpien←←000020		; Enable change of input byte size and input done interrupt channel
odpien←←000010		; Enable change of output byte size and output done interrupt channel


; Coni bits . . .

test←←100000		; Enter test mode (does anal-cranial inversion)
imperr←←040000		; Imp error
idone←←020000		; Input done
iend←←010000		; Input end.
odone←←004000		; Output done
pln←←20
p←←17
mpln←←20
array pdl[pln],messag[300],mpdl[mpln],obuf[3]
integer savep,cnt,savcni,data,leader,blkip

START:	calli
	movei 1,spwst
	movem 1,spwdsp
; put in initialize code here
	move 1,[xwd 400004,spw]
	call 1,[sixbit /SPCWGO/]
	jrst main

spw:	jrst @spwdsp
spwdsp:	0

zwait:	movei 1,zdsp
	jrst dsmg

zdsp:	move p,savep
	move 1,@(p)
	skipe (1)
	jrst dsm
	jrst cpopj1

nzwait:	movei 1,ndsp
	jrst dsmg

ndsp:	move p,savep
	move 1,@(p)
	skipn (1)
	jrst dsm
	jrst cpopj1

fwait:	movei 1,fdsp
	jrst dsmg

fdsp:	move p,savep
	move 1,@(p)
	conso imp,(1)
	jrst dsm
	jrst cpopj1


bwait:	movei 1,100
	movem 1,cnt
	movei 1,bdsp
dsmg:	movem 1,spwdsp
	movem p,savep
	jrst dsm

bdsp:	move p,savep
	move 1,@(p)
	conso imp,(1)
	jrst count
	aos (p)
cpopj1:	aos (p)
	popj p,

count:	sosle cnt
dsm:	call [sixbit /DISMIS/]
	coni imp,savcni
	aos (p)
	move 1,@(p)
	sos (1)
spwst:	move p,[iowd pln,pdl]
	movei 1,3
	movem 1,nopcnt#
noplop:	cono imp,strout!o32!odpien
	datao imp,[4B7]
	pushj p,fwait
	odone

	cono imp,fino
	pushj p,fwait
	odone

	sosle nopcnt
	jrst noplop

	cono imp,strout!o32!odpien
	datao imp,[13B15]
	pushj p,fwait
	odone

	datao imp,[byte (8)"H","i"," ","t"]
	pushj p,fwait
	odone

	datao imp,[byte (8)"h","e","r","e"]
	pushj p,fwait
	odone

	datao imp,[byte (8)15,12]
	pushj p,fwait
	odone

	cono imp,fino
	pushj p,fwait
	odone

lloop:	cono imp,strin!i32!idpien!iepien!clrst!clrwt
	cono imp,clrst!clrwt
	pushj p,fwait
	iend!idone

	coni imp,1
	datai imp,leader
	move 2,[iowd 300,messag]
	movem 2,blkip
	trne 1,iend
	jrst done
rloop:	pushj p,fwait
	iend!idone

	coni imp,1
	blki imp,blkip
	jfcl
	trnn 1,iend
	jrst rloop
done:	setom data
	pushj p,zwait
	data

	jrst lloop
space:	movei 1," "
outch:	sosg obuf+2
	output 1,
	idpb 1,obuf+1
	popj p,

octpnt:	movms 2
	idivi 2,10
	hrlm 3,(p)
	skipe 2
	pushj p,octpnt
	hlrz 1,(p)
	addi 1,"0"
	jrst outch

crlf:	movei 1,15
	pushj p,outch
	movei 1,12
	jrst outch

octpns:	pushj p,octpnt
	jrst space


main:	move p,[iowd mpln,mpdl]
	init 1,1
	sixbit /TTY/
	xwd obuf,0
	0
	outbuf 1,2
mloop:	skipn data
	jrst sleep
	ldb 2,[point 4,leader,3]
	pushj p,octpns
	ldb 2,[point 4,leader,7]
	pushj p,octpns
	ldb 2,[point 8,leader,15]
	pushj p,octpns
	ldb 2,[point 8,leader,23]
	pushj p,octpnt
	pushj p,crlf

	hrrz 5,blkip
	subi 5,messag-1
	lsh 5,2
	move 6,[point 8,messag]
	movei 7,10
	jumple 5,crslp
oloop:	ildb 2,6
	pushj p,octpns
	sojg 7,aftcr
	pushj p,crlf
	movei 7,10
aftcr:	sojg 5,oloop
	pushj p,crlf

	hrrz 5,blkip
	subi 5,messag-1
	lsh 5,2
	move 6,[point 8,messag]
tloop:	ildb 1,6
	andi 1,177
	pushj p,outch
	sojg 5,tloop
	pushj p,crlf

crslp:	pushj p,crlf
	output 1,
	setzm data
sleep:	movei 1,1
	call 1,[sixbit /SLEEP/]
	jrst mloop

end start